package com.amit.Basic_Simple_Program;

import java.util.Scanner;

public class Add_Matrics {

	public static void main(String[] args) {
		
		int c,d,m,n;
		int first[][];
		int second[][];
		int sum[][];
		
		System.out.println("Enter the number of rows and colums");
		Scanner sc=new  Scanner(System.in);
		
		 m=sc.nextInt();
		 n=sc.nextInt();
		 
		 first=new int[m][n];
		 second=new int[m][n];
		 sum=new int[m][n];
		 
		 System.out.println("Enter the element of first matrics");
		 
		 for(int i=0;i<m;i++)
		 {
			 for(int j=0;j<n;j++)
			 {
				 first[i][j]=sc.nextInt();
			 }
		 }
		 
    System.out.println("Enter the element of second matrics");
		 
		 for(int i=0;i<m;i++)
		 {
			 for(int j=0;j<n;j++)
			 {
				 second[i][j]=sc.nextInt();
			 }
		 }
		 
		 
		 System.out.println("The sum of two matrics");
		 
		 for(int i=0;i<m;i++)
		 {
			 for(int j=0;j<n;j++)
			 {
				 sum[i][j]=first[i][j]+second[i][j];
			 }
		 }
		 
		 
		 for(int i=0;i<m;i++)
		 {
			 for(int j=0;j<n;j++)
			 {
				 System.out.println(sum[i][j]);
			 }
		 }
		
		
		
		
		

	}

}
